<?php
/**
 * 搜索引擎模型 - 核心应用
 * @author jason <yangjs17@yeah.net> 
 * @version TS3.0
 */
class ResourceModel extends Model {

	protected $tableName = 'resource';
	protected	$fields	= array(
		0=>'id',
		1=>'type',
		2=>'category',
		3=>'resource_name',
		4=>'resource_img',
		5=>'attach_id',
		6=>'resource_info',
		7=>'resource_type',
		8=>'resource_teacher',
		9=>'is_tj',
		10=>'learn_sum',
		11=>'admin_id',
		12=>'ctime',
		13=>'is_del',
	);
	//通过学生id查询学员的相关信息
	public function getstudentById($stu_id) {	
		$data=M("student")->where("stu_id=".$stu_id)->field("class_id,stu_name,birth_condition")->find();
		$class=M("class")->where("class_id=".$data["class_id"])->field("class_name,class_type")->find();
		$data["class_name"]=$class["class_name"];
		if($class["class_type"]==1){
			$data["class_type"]="大班";
		}else if($class["class_type"]==2){
			$data["class_type"]="中班";
		}else if($class["class_type"]==3){
			$data["class_type"]="小班";
		}else{
			$data["class_type"]="混龄班";
		}
		return $data;
	}
}